package cn.yitun.chat.yitunservercommonlib.constant;

/**
 * redis常量
 */
public class RedisConstant {

    /**
     * 分隔符
     */
    private final static String splitChar = "-";
    /**
     * 默认过期时间
     */
    public static final int defalutExpireTime = 12 * 60 * 60 ;


    /**
     * 用户验证码
     *
     * @param userName
     * @return
     */
    public static String getVerifyCodeKey(String userName) {
        return "verify_code" + splitChar + userName;
    }

    /**
     * 获取用户登录错误次数的key
     *
     * @param userName
     * @return
     */
    public static String getUserLoginErrNumKey(String userName) {
        return "user_login_err_num" + splitChar + userName;
    }

    /**
     * 获取用户token key
     *
     * @param userId 用户id
     * @return
     */
    public static String getUserKey(Long userId) {
        return "user-Token-code" + splitChar + userId;
    }
    /**
     * 获取用户token key
     *
     * @param code 用户唯一标记
     * @return
     */
    public static String getUserIdKey(String code) {
        return "id-Token" + splitChar + code;
    }
    /**
     * 获取用户token key
     *
     * @param userId 用户id
     * @return
     */
    public static String getUserIdKey(Long userId) {
        return "id-Token-code" + splitChar + userId;
    }
    /**
     * 获取用户token key
     *
     * @param code 用户唯一标记
     * @return
     */
    public static String getUserKey(String code) {
        return "user-Token" + splitChar + code;
    }

}
